﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="RegionList.aspx.cs" Inherits="Com.CMS263.Web.manage.ManageRegion.RegionList" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">

    <script src="/manage/js/jquery-1.4.2.min.js"></script>

    <link href="/manage/css/common.css" rel="stylesheet" type="text/css" />
    <link href="/manage/css/main.css" rel="stylesheet" type="text/css" />
    <link href="/manage/css/box.css" rel="stylesheet" type="text/css" />

    <script language="javascript" type="text/javascript">
        function del(id, obj) {
            if (confirm('删除后不可恢复，删除区域后，子分类也会被删除')) {
                $.post("action.aspx?op=del", { id: id }, function (data) {
                    if (data == "ok") {
                        alert('删除成功');
                        $(obj.parentNode.parentNode).remove();
                    }
                })
            }
        }
        function delchild(id, obj) {
            if (confirm('删除后不可恢复')) {
                $.post("action.aspx?op=del", { id: id }, function(data) {
                    if (data == "ok") {
                        alert('删除成功');
                        $(obj.parentNode.parentNode).remove();
                    }
                })
            }
        }
    </script>

</head>
<body>
    <form id="form1" runat="server">
    <div class="main">
        <div class="mainMenu">
            <div class="mainMenuList">
                <ul>
                    <li><a href="region_add.aspx"><b>添加区域</b><span></span></a></li>
                    <li class="s"><a><b>区域列表</b><span></span></a></li>
                </ul>
            </div>
        </div>
        <div class="mainContent">
            <div class="productList">
                <table width="100%" border="0" cellspacing="0" cellpadding="0" class="table2">
                    <tr>
                        <th width="40" class="c">
                            编号
                        </th>
                        <th class="c">
                            名称
                        </th>
                        <th class="c">
                            排序
                        </th>
                        <th class="c">
                            推荐
                        </th>
                        <th class="c">
                            操作
                        </th>
                    </tr>
                    <% foreach (var item in list)
                       {
                           if (item.Father == 0)
                           {%>
                    <tr>
                        <td class="c">
                            <%=item.Id%>
                        </td>
                        <td class="c">
                            <%=item.Name%>
                        </td>
                        <td class="c">
                            <%=item.Regionorder%>
                        </td>
                        <td class="c">
                            <%if (item.IsBest == 1)
                              { %><span style="color:Red">推荐</span><%}
                              else { %>正常<%} %>
                        </td>
                        <td class="c">
                            <a href="region_edit.aspx?id=<%=item.Id %>">修改</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a style="cursor: pointer" onclick="del(<%=item.Id %>,this)">
                                删除</a>
                        </td>
                    </tr>
                    <%
                        foreach (var item2 in list)
                        {
                            if (item2.Father == item.Id)
                            { %>
                    <tr>
                        <td class="c">
                            <%=item2.Id%>
                        </td>
                        <td class="c">
                            <span style="color: red">**</span><%=item2.Name%>
                        </td>
                        <td class="c">
                            <%=item2.Regionorder%>
                        </td>
                        <td class="c">
                            <%if (item2.IsBest == 1)
                              { %><span style="color:Red">推荐</span><%}
                              else { %>正常<%} %>
                        </td>
                        <td class="c">
                            <a href="region_edit.aspx?id=<%=item2.Id %>">修改</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a style="cursor: pointer" onclick="delchild(<%=item2.Id %>,this)">
                                删除</a>
                        </td>
                    </tr>
                    <%  }
                            }
                               }
                           } %>
                    <tr>
                        <td colspan="5">
                            <div style="float: right; margin-right: 100px">
                            </div>
                        </td>
                    </tr>
                </table>
            </div>
        </div>
    </div>
    </form>
</body>
</html>
